package com.lanmaoly.web.common;

/**
 * 静态配置资源类
 *
 * @author Administrator
 */
public class Constant {
    /**
     * session key
     */
    public static final String KAPTCHA_SESSION_KEY = "KAPTCHA_SESSION_KEY";

    public enum UserType {
        /**
         * 用户类型1-个人 2-企业
         */
        PERSON(1),
        COMPANY(2);
        private Integer value;

        UserType(Integer value) {
            this.value = value;
        }

        public Integer getValue() {
            return value;
        }
    }

    public enum HashType {
        /**
         * hash表中59表示互金平台保全api-合同信息
         */
        NORM(59, 6001);

        private Integer code;
        private Integer busType;

        HashType(Integer code, Integer busType) {
            this.code = code;
            this.busType = busType;
        }

        public Integer getCode() {
            return code;
        }

        public static Integer getBusTypeByCode(Integer code) {
            for (HashType type : values()) {
                if (type.code.equals(code)) {
                    return type.busType;
                }
            }
            return code;
        }
    }

    public enum DealBusType {
        /**
         * 交易表类型 1001-存证基础 1002-电子存证（上海版） 2002-商户保全（无用） 3001-签章厂商存证/保全（签章行业）
         * 5001-日志 6001-大而全
         */
        STORAGE(1001, true),
        SHANGHAI(1002, false),
        SIGN(3001, false),
        LOG(5001, false),
        NORM(6001, true);

        private Integer code;
        private Boolean issue;

        DealBusType(Integer code, Boolean issue) {
            this.code = code;
            this.issue = issue;
        }

        public Integer getCode() {
            return code;
        }

        public Boolean getIssue() {
            return issue;
        }

        public static boolean getIssueByCode(Integer code) {
            for (DealBusType busType : values()) {
                if (busType.code.equals(code)) {
                    return busType.issue;
                }
            }
            return false;
        }
    }
}
